package org.clickframes.lab;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

@WebServlet(urlPatterns={"/logout"}, name = "logout-servlet")
public class LogoutServlet extends HttpServlet {
	@SuppressWarnings("unused")
	private final Log logger = LogFactory.getLog(getClass());
	
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		//this doesn't appear to work as expected.  
		request.logout();
		//old fashioned method.
		request.getSession(true).invalidate();
	}

	private static final long serialVersionUID = 1L;
}